<template>
  <j-modal
    :title="title"
    :visible="visible"
    :fullscreen.sync="fullscreen"
    @close="close"
    @cancel="close"
    :footer="footer"
    :back="true"
    @onBack="close"
  >
    <a-tabs @change="handleChangeTabs" defaultActiveKey="1">
      <a-tab-pane tab="基础信息" key="1" :forceRender="true">
        <member-info ref="MemberInfo"></member-info>
      </a-tab-pane>
      <a-tab-pane tab="调查问卷" key="2" :forceRender="true">
        <member-question ref="MemberQuestion"></member-question>
      </a-tab-pane>
      <a-tab-pane tab="医学报告" key="3" :forceRender="true">
        <mr-list ref="MrList"></mr-list>
      </a-tab-pane>
      <a-tab-pane tab="检测报告" key="4" :forceRender="true">
        <pe-list ref="PeList" :mainId="memberId"></pe-list>
      </a-tab-pane>
      <a-tab-pane tab="运动康复计划" key="5" :forceRender="true">
        <exercise-plan-list ref="ExercisePlanList" :mainId="memberId"></exercise-plan-list>
      </a-tab-pane>
      <a-tab-pane tab="体重打卡" key="6" :forceRender="true">
        <clock-in-weight-list ref="ClockInWeightList"></clock-in-weight-list>
      </a-tab-pane>
      <a-tab-pane tab="饮食打卡" key="7" :forceRender="true">
        <dynamic-list ref="DynamicList" :mainId="memberId"></dynamic-list>
      </a-tab-pane>
    </a-tabs>

  </j-modal>
</template>

<script>
  import MemberInfo from '../member/MemberInfo'
  import PeList from '../pe/PeList'
  import MrList from '../mr/MrList'
  import ExercisePlanList from '../exercise/ExercisePlanList'
  import ClockInWeightList from '../clock/ClockInWeightList'
  import MemberQuestion from './MemberQuestion'
  import DynamicList from '../dynamic/DynamicList'

  export default {
    name: 'MemberDetail',
    components: {
      DynamicList,
      MemberQuestion,
      MemberInfo,
      PeList,
      MrList,
      ExercisePlanList,
      ClockInWeightList
    },
    data() {
      return {
        active:"1",
        title: '',
        memberId: '',
        visible: false,
        footer: false,
        fullscreen: true

      }
    },
    methods: {
      onBack(){
        this.visible = false
      },
      close() {
        this.visible = false
      },
      show(id) {
        this.memberId = id
        this.visible = true
        this.$nextTick(()=>{
          this.$refs.MemberInfo.getById(this.memberId)
        })
      },
      handleChangeTabs(key) {
        if (key === '1') {
            this.$refs.MemberInfo.getById(this.memberId)
        }
        if (key === '2') {
          this.$refs.MemberQuestion.getById(this.memberId)
        }
        if (key === '3') {
          this.$refs.MrList.getMainId(this.memberId)
        }
        if (key === '4') {
          this.$refs.PeList.getMainId(this.memberId)
        }
        if (key === '5') {
          this.$refs.ExercisePlanList.getMainId(this.memberId)
        }
        if (key === '6') {
          this.$refs.ClockInWeightList.getMainId(this.memberId)
        }
        if (key === '7') {
          this.$refs.DynamicList.getMainId(this.memberId)
        }
      }
    }

  }


</script>
